/**
 * $Id: UserService.java May 30, 2015 10:05:19 AM hdp
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.aurora.app.service;

import java.util.ArrayList;
import java.util.List;

import javax.annotation.Resource;
import javax.persistence.LockModeType;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.aurora.app.dao.UserDao;
import com.aurora.app.entity.User;
import com.aurora.base.dao.BaseDao;
import com.aurora.base.dto.Order;
import com.aurora.base.dto.QueryResult;
import com.aurora.base.service.BaseService;
import com.aurora.base.util.Utf8Util;



/**
 * 
 * @author yongjiang.lin
 *
 */

@Service
public class UserService extends BaseService<User> {

	@Resource
	private UserDao userDao;

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.tentcoo.base.service.impl.AbstractBaseServiceImpl#getBaseDao()
	 */
	@Override
	public BaseDao<User> getBaseDao() {
		return this.userDao;
	}

	/**
	 * 获取用户
	 * @param openid
	 * @return
	 */
	public User findByOpenid(String openid) {
		List<User> list = this.userDao.list("o.openid = ? and o.isDelete = 0", openid);
		if (list.size() > 0) {
			return list.get(0);
		}
		return null;
	}
}
